/**
 * 页面路由防御性兼容
 */

export default function usePageRouter() {
  const back = () => {
    const pages = uni.$u.pages();
    if (pages.length <= 1) {
      return uni.switchTab({
        url: '/pages/tab/home/index',
      });
    }
    uni.navigateBack();
  };
  return {
    back,
  };
}
